Page({
  /**
   * 页面的初始数据
   */
  data: {
    corpKey: '',
    list: '',
    industName: '',
    corpName: '',
    listEcharts: []
  },

  onclick () {
  },

  async initPk () {
    const params = {
      corpKey: this.data.corpKey,
      tab: this.data.list,
    }
    console.log(params, 'params')
    const { data } = await getApp().globalData.request("/map/industPk", params, "POST");
    console.log(data, 'data')
    const needList = data.trendList.filter(pre => pre.y[0].length > 0 || pre.y[1].length > 0)
    console.log(needList, 'needList')
    needList.forEach(val => {
      this.data.listEcharts.push({
        years: [1],
        trend: val.trend,
        xData: val.x,
        yData: val.y,
        title: val.title,
        type: "line",
      });
    })
    this.setData({
      listEcharts: this.data.listEcharts,
      industName: data.industName,
      corpName: data.corpName
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad (options) {
    const corpKey = options.corpKey
    const list = JSON.parse(options.list)
    this.setData({
      corpKey: corpKey,
      list: list,
    })
    this.initPk()
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () { },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () { },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () { },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () { },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () { },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {},
});
